﻿using GraphProcessor;
using IQIGame.Onigao.Logic;

namespace IQIGame.Onigao.GamePlay.Editors
{
    public abstract class LevelServiceTriggerNode : LevelServiceBaseNode
    {
        [Input("模拟触发", false)]
        protected  LevelServiceExecutionCustom_SimulateTrigger simulate;
        protected abstract ServiceTriggerType triggerType { get; }
        [Output("服务", false), Vertical] public EditorLevelServiceConfig editor;

        protected virtual string triggerName => this.GetType().Name;
        public override string name => this.triggerName + ":" + LondIDToInt2(this.GUIDLong);

        protected override void Process()
        {
            base.Process();
            var rTrigger = new EditorLevelServiceTriggerConfig()
            {
                triggerType = (int)this.triggerType,
                customConfig = this.CreateConfig()
            };
            if (this.simulate != null)
            {
                this.simulate.triggerConfig = rTrigger;
            }
            else
            {
                if (this.graph == null)
                {
                }
                this.editor = new EditorLevelServiceConfig()
                {
                    trigger = rTrigger,
                    id = this.GenerateIDInt(),
                };

                LevelServiceBlackboard.Instance.AddService(this.editor);
            }
        }

        protected virtual LevelServiceCustomConfig CreateConfig()
        {
            return null;
        }
    }

    public class LevelServiceTriggerEditor
    {
        
    }
}